package utils

import (
	"mall/common/globalkey"
)

func ParseTaxonomy(taxonomy string) int32 {
	var res int32
	switch taxonomy {
	case globalkey.TermTaxonomyNameCategory:
		res = globalkey.TermTaxonomyCategory
	case globalkey.TermTaxonomyNamePostTag:
		res = globalkey.TermTaxonomyTag
	case globalkey.TermTaxonomyNameReviewTag:
		res = globalkey.TermTaxonomyReviewTag
	default:
		res = globalkey.TermTaxonomyCategory
	}

	return res
}

func FormatTaxonomy(taxonomy int32) string {
	var res string
	switch taxonomy {
	case globalkey.TermTaxonomyCategory:
		res = globalkey.TermTaxonomyNameCategory
	case globalkey.TermTaxonomyTag:
		res = globalkey.TermTaxonomyNamePostTag
	case globalkey.TermTaxonomyReviewTag:
		res = globalkey.TermTaxonomyNameReviewTag
	default:
		res = globalkey.TermTaxonomyNameCategory
	}

	return res
}

func ParseCardType(cardType string) int32 {
	var res int32
	switch cardType {
	case globalkey.ForumCardTypeNameBrand:
		res = globalkey.ForumCardTypeBrand
	case globalkey.ForumCardTypeNamePerfume:
		res = globalkey.ForumCardTypePerfume
	case globalkey.ForumCardTypeNameProduct:
		res = globalkey.ForumCardTypeProduct
	default:
		res = globalkey.ForumCardTypeEntry
	}

	return res
}

func FormatCardType(cardType int32) string {
	var res string
	switch cardType {
	case globalkey.ForumCardTypeBrand:
		res = globalkey.ForumCardTypeNameBrand
	case globalkey.ForumCardTypePerfume:
		res = globalkey.ForumCardTypeNamePerfume
	case globalkey.ForumCardTypeProduct:
		res = globalkey.ForumCardTypeNameProduct
	default:
		res = globalkey.ForumCardTypeNameEntry
	}

	return res
}
